cvtRef Conversion Method — Modbus Only
With Modbus-based devices, device-specific date-time register data must be converted from its source format to the Microsoft standard date-time format. CygNet provides conversion methods to do so. Data converted by a cvtRef conversion may itself be converted using a reference method.
Date-time conversions are always introduced using the cvtRef attribute at the data group element (DataGroupElement) level. Register data must be supplied to a conversion method by one or more specific data group elements. Conversions depend on one or more specialized attributes to reference the register data and to modify that data. Date-time conversions are not limited to the "Date and Time" data group; any Modbus data group can be configured to use the conversions supported by the cvtRef attribute.
See the following conversion methods for more information:
| cvtRef Conversion Methods | ||
|---|---|---|
Time3Byte
The Time3Byte conversion method applies only to Thermo SuperFlo II devices. Time3Byte converts then combines three-byte date and time data into the Microsoft standard date-time format. The following parameters are specific to this conversion method:
- deidDate — References a data group element that provides the source date value. Dates are converted from the format YYMMDD where the first byte corresponds to YY, the second byte corresponds to MM, and the third byte corresponds to DD. If this parameter is not specified, a default date is returned.
- deidTime — References a data group element that provides the source time value. Times are converted from the format HHMMSS where the first byte corresponds to HH, the second byte corresponds to MM, and the third byte corresponds to SS. If this parameter is not specified, HH:MM:SS display as 00:00:00.
Example
In the following example, the data group element DevTm uses the conversion method Time3Byte. Time3Byte gets its source date from the data group element UnitDate. It gets its source time from the data group element UnitTime.
|
<DevTm desc="Device Time (Local)" type="r8" cvtRef="Time3Byte"deidDate="UnitDate"deidTime="UnitTime"/> |
TimeComp
TimeComp converts date and time component data into the Microsoft standard date-time format. The following parameters are specific to this conversion method:
- deidYear — References a data group element that provides the source year value in a four-digit year format.
- deidMonth — References a data group element that provides the source month in a value 1-12.
- deidDay — References a data group element that provides the source day in a value 1-31.
- deidHour — References a data group element that provides the source hour in a value 0-23.
- deidMinute — References a data group element that provides the source minute in a value 0-59.
- deidSecond — References a data group element that provides the source second in a value 0-59.
- deidDayOfWeek — References a data group element that provides the source day of week in a value 1-7 where 1 = Sunday, 2 = Monday, and so forth.
Example
In the following example, the data group element DevTm uses the conversion method TimeComp. TimeComp gets its dates from the data group element Year, Month, and Day. It gets its times from the data group element Hour, Minute, and Second. And its day of the week comes from DayOfWeek.
|
<DevTm desc="Device Time (Local)" type="r8" cvtRef="TimeComp"deidYear="Year"deidMonth="Month"deidDay="Day"deidHour="Hour"deidMinute="Minute"deidSecond="Second"deidDayOfWeek="DayOfWeek"/> |
TimeEnron
TimeEnron converts Enron-format date and time data into the Microsoft standard date-time format. Referenced values must be specified in Enron format, which are decimal numbers representing MMDDYY.0 and/or HHMMSS.0. The following parameters are specific to this conversion method:
- deidDate — See deidDate.
- deidTime — See deidTime.
- formatDate — Optional. See formatDate.
- formatTime — Optional. See formatTime.
Example
In the following example, the data group element DevTm uses the conversion method TimeEnron. TimeEnron gets the Enron date from the data group element UnitDate. It gets the Enron time from the data group element UnitTime.
|
<DevTm desc="Device Time (Local)" type="r8" cvtRef="TimeEnron" deidDate="UnitDate" formatDate="MMddyy" deidTime="UnitTime" formatTime="HHmmss"/> |
TimeString
TimeString converts date and time string data into the Microsoft standard date-time format. The following parameters are specific to this conversion method:
- deidTime — References a data group element that provides the source date/time value in a string format.
- formatTime — This attribute is required only if the time can be sent to the device. Describes the format of the string representation to be sent. For example, strFormat="%m/%d/%y %H:%M:%S" would send a value to be interpreted like 01/30/07 10:22:00.
TimeT
TimeT converts UTC date and time data (seconds since January 1, 1970) into the Microsoft standard date-time format. The following parameters are specific to this conversion method:
- deidTime — References a data group element that provides the source date/time in UTC format.
Example
In the following example, the data group element DateTime uses the conversion method TimeT. TimeT gets its timestamp from the data group element STime.
|
<DateTime desc="Timestamp" type="r4" cvtRef="TimeT"deidTime="STime"/> |
TimeTLocal
TimeTLocal converts local device date and time data (seconds since January 1, 1970) into the Microsoft standard date-time format. The following parameters are specific to this conversion method:
- deidTime — References a data group element that provides the source date/time in local device date and time format.
Example
In the following example, the data group element DateTime uses the conversion method TimeTLocal. TimeTLocal gets its timestamp from the data group element STime.
|
<DateTime desc="Timestamp" type="r4" cvtRef="TimeTLocal"deidTime="STime"/> |
TimeTLocal1980
The TimeTLocal1980 conversion method applies only to Weatherford WellPilot F-22 (CEO-IV) devices. TimeTLocal1980 converts local device date and time data (seconds since January 1, 1980) into the Microsoft standard date-time format. The following parameters are specific to this conversion method:
- deidTime — References a data group element that provides the source date/time in local device date and time format.
Example
In the following example, the data group element DateTime uses the conversion method TimeTLocal1980. TimeTLocal1980 gets its timestamp from the data group element AlOnTmRaw.
|
<DateTime desc="Al On Time" type="r8" cvtRef="TimeTLocal1980" arrSize="50" arrRegOff="2" deidTime="AlOnTmRaw" hidden="true"/> |
TimeTLocal2000
TimeTLocal2000 converts local device date and time data (seconds since January 1, 2000) into the Microsoft standard date-time format. The following parameters are specific to this conversion method:
- deidTime — References a data group element that provides the source date/time in local device date and time format.
Example
In the following example, the data group element CtrlDTOle uses the conversion method TimeTLocal2000. TimeTLocal2000 gets its timestamp from the data group element CtrlDTRaw.
|
<CtrlDTOle desc="Controller Date/Time Ole" deidTime="CtrlDTRaw"cvtRef="TimeTLocal2000" hidden="true"/> |
TimeTLocalOffset
TimeTLocalOffset converts local device date and time data into the Microsoft standard date-time format. It does so by adding a user-defined string offset to January 1, 1970 then adding the referenced data group element value to the result of that sum. In effect, the arithmetic is January 1, 1970 + secondsSince string date offset + deidTime in seconds = date and time. The following parameters are specific to this conversion method:
- deidTime — References a data group element that provides a number of seconds. This value is added to the string date offset specified by secondsSince.
- secondsSince — Specifies the offset from January 1, 1970 from which to append the value returned from deidTime. The secondsSince value must be in format YYYYMMDDHHMMSSNNN, where NNN are optional milliseconds. The value must post-date January 1, 1970.
Example
In the following example, the data group element DateTime uses the conversion method TimeTLocalOffset. secondsSince specifies a post-January 1, 1970 string date in the format YYYYMMDDHHMMSS. The value in seconds from deidTime is then added to the string specified by secondsSince.
|
<DateTime desc="Timestamp" type="r4" deidTime="STime"cvtRef="TimeTLocalOffset"secondsSince="19751001151035"/> |


